package demo4;

public class Test {

    public static void main(String[] args)
            throws CloneNotSupportedException
    {
        Person person1=new Person("zhangsan",20);
        Person person2=(Person) person1.clone();
//        System.out.println(person2);
        System.out.println(person1.money.val);
        System.out.println(person2.money.val);
        person2.money.val=999.99;
        //深拷贝
        //money也被拷贝了一份
        System.out.println(person1.money.val);
        System.out.println(person2.money.val);
    }


}
